load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

cpp_library(
    name = "broadcast",
    exported_deps = [
        ":broadcast_handler",  # @manual
        ":broadcast_pool",  # @manual
        ":observing_handler",  # @manual
        ":subscriber",  # @manual
    ],
)

# Main Rules

cpp_library(
    name = "broadcast_handler",
    headers = [
        "BroadcastHandler.h",
        "BroadcastHandler-inl.h",
    ],
    exported_deps = [
        ":subscriber",
        "//wangle/channel:async_socket_handler",
        "//wangle/channel:handler",
        "//wangle/channel:pipeline",
    ],
)

cpp_library(
    name = "broadcast_pool",
    headers = [
        "BroadcastPool.h",
        "BroadcastPool-inl.h",
    ],
    exported_deps = [
        ":broadcast_handler",
        "//folly:thread_local",
        "//folly/futures:shared_promise",
        "//folly/io/async:delayed_destruction",
        "//wangle/bootstrap:base_client_bootstrap",
        "//wangle/bootstrap:client_bootstrap",
        "//wangle/channel:pipeline",
    ],
)

cpp_library(
    name = "observing_handler",
    headers = [
        "ObservingHandler.h",
        "ObservingHandler-inl.h",
    ],
    exported_deps = [
        ":broadcast_pool",
        ":subscriber",
        "//wangle/bootstrap:accept_routing_handler",
        "//wangle/bootstrap:server_bootstrap",
    ],
)

cpp_library(
    name = "subscriber",
    headers = ["Subscriber.h"],
    exported_deps = [
        "//folly:exception_wrapper",
    ],
)
